package org.atguigu.beanlife.processor;

import org.atguigu.beanlife.bean.User;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @Author:lyd
 **/
@Component
public class UserProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof User){
            System.out.println("postProcessBeforeInitialization--->>执行");

        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof User) {

            System.out.println("postProcessAfterInitialization--->>执行");
        }
        return bean;
    }
}
